package csc420groupproject;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

/**
 *
 * @author drenz
 */
public class PopupListener extends MouseAdapter {
    private GUI gui;

    public PopupListener(GUI gui) {
        this.gui = gui;
    }

    @Override
    public void mousePressed(MouseEvent e) {
        showPopup(e);
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        showPopup(e);
    }

    private void showPopup(MouseEvent e) {
        if(e.isPopupTrigger()) {
            this.gui.popup.show(e.getComponent(), e.getX(), e.getY());
        }
    }
}
